package com.markhsiu.httpserver.pool;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import com.markhsiu.common.ConstantUtil;

public class ThreadPool {

	private  final ExecutorService pools  ;
	private static final ThreadPool POOL = new ThreadPool();
	public ThreadPool(){
		pools = Executors.newFixedThreadPool(2 * ConstantUtil.getWorkerThreads());
	}
	
	public void submit(Runnable task){
		pools.submit(task);
	}
	
	public static void execute(Runnable task){
		POOL.submit(task);
	}

}
